<%@page import="itpenguin.review.entities.Item"
%><%@page import="java.util.Date"
%><%@page import="java.util.List"
%><%@page import="itpenguin.common.PMFactory"
%><%@page import="javax.jdo.PersistenceManager"
%><%@page import="javax.jdo.Query"
%><%@ page language="java" contentType="text/xml; charset=UTF-8" pageEncoding="UTF-8"
%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" 
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" 
%><?xml version="1.0" encoding="UTF-8"?>
<fmt:setLocale value="ja-JP" />
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:g="http://base.google.com/ns/1.0">
<%
	PersistenceManager pm = PMFactory.getInstance().getPersistenceManager();
	Query query = pm.newQuery("select from itpenguin.review.entities.Item order by reviewDate desc");
	int maxResults = 100;
	String pathInfo = request.getPathInfo();
	if (pathInfo != null) {
		String maxResStr = pathInfo.substring(1, pathInfo.length());
		try {
			maxResults = Integer.parseInt(maxResStr);
		} catch (NumberFormatException e){
		}
	}
	query.setRange(0, maxResults);
	List<Item> itemList = (List<Item>) query.execute();
	pageContext.setAttribute("itemList", itemList);
	pageContext.setAttribute("prefix", "http://review.it-penguin.com");
	pageContext.setAttribute("now", new Date());
%>
<title>ペンギン・レビュー</title>
<subtitle type='html'>どういうわけか、偉そうに、本や映像作品、音楽、ゲームに１００点満点の点数をつけてしまいます。</subtitle>
	<c:forEach items="${itemList}" var="item" varStatus="status">
		<c:if test="${status.count == 1}">
			<updated><fmt:formatDate value="${item.lastModified}" pattern="yyyy-MM-dd" timeZone="UTC" />T<fmt:formatDate value="${item.lastModified}" pattern="HH:mm:ss" timeZone="UTC" />Z</updated>
			<link rel='self' type='application/atom+xml' href='${prefix}/feed'/>
			<link rel='alternate' type='text/html' href='${prefix}/'/>
			<author>
			<name>ヒロ†</name>
			</author>
			<id>tag:review.it-penguin.com,2012-03-27:/</id>
		</c:if>
		<entry>
		<title>${item.reviewTitle}</title>
		<id>tag:review.it-penguin.com,${item.itemId}</id>
		<link rel='alternate' type='text/html' href="${prefix}/review/${item.itemId}" />
		<content type='html'><c:out escapeXml="true" value="${item.review}" /></content>
		<published><fmt:formatDate value="${item.reviewDate}" pattern="yyyy-MM-dd" timeZone="UTC" />T<fmt:formatDate value="${item.reviewDate}" pattern="HH:mm:ss" timeZone="UTC" />Z</published>
		<updated><fmt:formatDate value="${item.lastModified}" pattern="yyyy-MM-dd" timeZone="UTC" />T<fmt:formatDate value="${item.lastModified}" pattern="HH:mm:ss" timeZone="UTC" />Z</updated>
		</entry>
	</c:forEach>
</feed>
